Skip to content

Fix #3187: Don't crash in requiredClass if class is missing #3748

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 2, 2018

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Jan 4, 2018

Also, issue stacktraces for missing refs only if Y-debug-missing-refs is set.

The test case issues error messages without positions, so it is left in pos.

@odersky
Copy link
Contributor Author

odersky commented Jan 4, 2018

I know this could be improved (e.g. trying to relate error messages to source), but I won't have the time to sink more effort into this.

@smarter
Copy link
Member

smarter commented Jan 4, 2018

The test case issues error messages without positions, so it is left in pos.

It's possible to check for errors without positions by putting // nopos-error anywhere in the file.

Copy link
Member

@smarter smarter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise LGTM

@@ -277,7 +277,7 @@ object Denotations {
disambiguate(p) match {
case m @ MissingRef(ownerd, name) =>
if (generateStubs) {
m.ex.printStackTrace()
if (ctx.settings.YdebugMissingRefs.value) m.ex.printStackTrace()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@smarter
Copy link
Member

smarter commented Jan 7, 2018

Somehow the tests compiled with an optimized compiler fail with:

[error] Test dotty.tools.ShowClassTests.loadDotty failed: java.lang.AssertionError: assertion failed: stubs found: 36, expected: 5
[error] stubs: class Stream,class Seq,class BufferedIterator,class Iterator,class List,class Iterable,class TraversableOnce,class IndexedSeq,class Vector,class Range,class StringBuilder,module mutable,class ::,module immutable,class Traversable,class Set,class Map,module immutable,class Stream,class Seq,class BufferedIterator,class Iterator,class List,class Iterable,class TraversableOnce,class IndexedSeq,class Vector,class Range,class StringBuilder,module mutable,class ::,module immutable,class Traversable,class Set,class Map,module immutable, took 0.043 sec
[error]     at dotty.DottyPredef$.assertFail(DottyPredef.scala:39)
[error]     at dotty.tools.ShowClassTests.showPackage$$anonfun$4(ShowClassTests.scala:82)
[error]     at scala.compat.java8.JProcedure1.apply(JProcedure1.java:18)
[error]     at scala.compat.java8.JProcedure1.apply(JProcedure1.java:10)
[error]     at dotty.tools.ShowClassTests.doTwice(ShowClassTests.scala:58)
[error]     at dotty.tools.ShowClassTests.showPackage(ShowClassTests.scala:83)
[error]     at dotty.tools.ShowClassTests.loadDotty(ShowClassTests.scala:145)
[error] ...

@odersky
Copy link
Contributor Author

odersky commented Jan 8, 2018

@OlivierBlanvillain Can you help debug this?

@OlivierBlanvillain
Copy link
Contributor

I couldn't reproduce on my laptop, I will give it another shot when I'm back in Lausanne

@OlivierBlanvillain
Copy link
Contributor

OlivierBlanvillain commented Jan 31, 2018

I finally managed to isolate that bug. The neg test case added in this PR breaks dotty.tools.ShowClassTests when compiled before, as shown by the latest commit (it's independent of being bootstrapped or optimized).

The problem comes from Symbols.stubs, a mutable variable shared between compiler instances and read in dotty.tools.ShowClassTests. When neg/i3187.scala is run first, a bunch of stubs are added to this var which break assumptions made in ShowClassTests.

I'm not sure what would be the best solution here, I guess we could remove either neg/i3187.scala or ShowClassTests...

@smarter
Copy link
Member

smarter commented Jan 31, 2018

I'm not sure what would be the best solution here, I guess we could remove either neg/i3187.scala or ShowClassTests...

No, I think that's a real issue you found, we shouldn't have a shared mutable stub list, it should be per-compiler at the very least.

@OlivierBlanvillain
Copy link
Contributor

OlivierBlanvillain commented Jan 31, 2018

This list of stubs is only used for testing, in ShowClassTests, so removing that test would solve the issue.

odersky and others added 5 commits January 31, 2018 18:46
Also, issue stacktraces for missing refs only if Y-debug-missing-refs is set.

The test case issues error messages without positions, so it is left in `pos`.
This tests was already mostly disabled. The part that was left is also
outdated: it checked that the dotty package creates less than 5 stubs,
when in current states it creates 0 stubs.
@smarter smarter merged commit d1c479f into scala:master Feb 2, 2018
@allanrenucci allanrenucci deleted the fix-#3187 branch February 2, 2018 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants